import Vue from 'vue'

const path = require ('path');

let ini = require('node-ini');
ini.encoding = 'utf-8';

Vue.prototype.$readIniFile = function (section, key) {
    let config = null;
    if(process.env.NODE_ENV === 'production'){
        config = ini.parseSync(path.dirname(process.execPath) + '/resources/data/config.ini');
    }else {
        config = ini.parseSync('./data/config_test.ini');
    }
    if(config[section]){
        return config[section][key] ? config[section][key] : '';
    }else {
        return '';
    }
}
